import { mainColorConfig, logoVisibleConfig, tabsVisibleConfig } from '@/settings'

const state = {
  drawerVisible: false, // 抽屉开关控制
  drawerTabsVisible: tabsVisibleConfig, // 标签页 是否显示
  drawerLogoVisible: logoVisibleConfig, // logo 是否显示
  drawerMainColor: mainColorConfig // 导航主色调
}

const mutations = {
  STATE_SETTING: (state, { key, value }) => {
    if (Object.prototype.hasOwnProperty.call(state, key)) {
      state[key] = value
    }
  }
}

const actions = {
  // 抽屉开关控制
  changeSetting({ commit }, data) {
    return new Promise((resolve, reject) => {
      commit('STATE_SETTING', data)
    })
  }
}

export default {
  state,
  mutations,
  actions
}
